package com.qf.springmvc02.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.qf.springmvc02.utils.SalarySerialize;
import lombok.Data;

import java.util.Date;

@Data
public class FastUser {

    // WriteMapNullValue 序列化null值的属性 ,WriteNullStringAsEmpty 遇到null -> ""
    @JSONField(serialzeFeatures = {SerializerFeature.WriteMapNullValue,SerializerFeature.WriteNullStringAsEmpty})
    private String id;
    @JSONField(name = "name")
    private String username;

    //sserialize = false序列化是忽略这个属性
    @JSONField(serialize = false)
    private String password;

    // format 指定日期格式的
//    @JSONField(format = "yyyy年MM月dd日")
    private Date birthday;

    @JSONField(format = "yyyy年MM月dd日")

    private Date marryDay;
    @JSONField(serializeUsing = SalarySerialize.class)
    private Double salary;
}
